#include "Builder.h"
#include "goaway.h"
#include <iostream>
#include <fstream>

int Builder_58com::makeCraw(std::string fromCity, std::string toCity, std::string date)
{
#ifdef _DEBUG
	cout << "Builder_58com : make Craw\n";
#endif // _DEBUG

		return tc.crawl(fromCity,toCity,date);		
}

int Builder_58com::getContent()
{
	this->content = tc.content;
	this->m_url = tc.url;

#ifdef _DEBUG
	ofstream ofs("content.html");
	ofs<<this->content;
	ofs.close();
#endif // _DEBUG

	return XX_OK;
}

int Builder_58com::makeParse(std::string fn)
{
	//////////////////////////////////////////////////////////////////////////
	//test
	string tmp,alltext;
	ifstream ifs("content.html");
	while(ifs)
	{
		getline(ifs,tmp);
		alltext+=tmp;
	}
	ifs.close();
	content = alltext;
	//////////////////////////////////////////////////////////////////////////
	return tp.parser(content, rc,m_url,fn);
}